import {defineStore} from "pinia"

export const useUser =  defineStore('users',{
    state(){
        return {
            username:'abs',
        }
    },
    // getters:{
    //     reverseName(state){
    //         return state.username.split("").reverse().join("")
    //     },
    //     newArr(state){

    //     }
    // }
    actions:{
        async fetch_data(a,b){
            console.log(a,b);
            try{
                let res = await fetch('/api/data/index.json')
            .then(body=>body.json())
            console.log(res);
            this.data=res.data
            }catch(e){
                console.log(e);
            }
        }
    }
})